#include <ast/ast.h>

namespace ast {
  NodeExp::NodeExp(Stage _stage): stage(_stage) {}

  void NodeExp::dot_string(std::string & str) {
    str = std::string(R"(Exp\n)")
      + "stage: " + std::string(magic_enum::enum_name(this->stage))
      + R"(\n)";
    switch(this->stage) {
    case EXP:
      str += "op_type: " + std::string(magic_enum::enum_name(this->op_type));
      break;
    case BRAC_EXP:
      // empty
      break;
    case INT_NUMBER:
      str += "int_number: " + std::to_string(this->int_number);
      break;
    case FLOAT_NUMBER:
      str += "float_number: " + std::to_string(this->float_number);
      break;
    case IDEN:
      str += "iden: " + this->iden;
      break;
    case ARRAY:
      // empty
      break;
    case FUNC:
      // empty
      break;
    default: Panic("exp op_type nudefined");
    }
  }

  void NodeExp::dot_accept(AstDot & ast_dot) {
    ast_dot.visit(*this);
  }

  void NodeExp::accept(ir::Visitor & visitor) {
    visitor.visit(*this);
  }
}
